package gl.android.jxzs;

import gl.BaseActivity;
import gl.android.biyiqing.BYQBaseActivity;
import gl.android.biyiqing.PassWordChangeActivity;
import gl.android.biyiqing.R;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

public class HtmlActivity extends BYQBaseActivity {

	private HtmlFragment mHtmlFragment;
	private String title = "详细内容";
	public final static String KEY_URL = "URL";
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_html);
		if (!TextUtils.isEmpty(getIntent().getStringExtra(
				PassWordChangeActivity.EXTRA_TITLE))) {
			title = getIntent().getStringExtra(
					PassWordChangeActivity.EXTRA_TITLE);
		}

		String context = getIntent().getStringExtra(
				KEY_URL);
		if (!TextUtils.isEmpty(context)) {
			context = getIntent().getStringExtra(
					KEY_URL);
		} else {
			context = "没有内容";
		}
		String contentAtvaorInfo = "";
		String creater = getIntent().getStringExtra(
				PassWordChangeActivity.EXTRA_CREATER);

		if (!TextUtils.isEmpty(creater)) {
			contentAtvaorInfo += "<p></p><p>" + "发布者 : " + creater + "</p>";
		} else {
		}
		String createTime = getIntent().getStringExtra(
				PassWordChangeActivity.EXTRA_TIME);
		if (!TextUtils.isEmpty(createTime)) {
			contentAtvaorInfo += "<p></p><p>" + "发布时间 : " + createTime + "</p>";
		} else {
		}
		if (!TextUtils.isEmpty(contentAtvaorInfo)) {
			context += contentAtvaorInfo;
		}
		mHtmlFragment = new HtmlFragment(true, context, getIntent()
				.getStringExtra(KEY_URL));
		getSupportFragmentManager().beginTransaction()
				.setCustomAnimations(android.R.anim.slide_in_left, 0)
				.replace(R.id.contatiner, mHtmlFragment)
				.commitAllowingStateLoss();
		initTitleBar();
	}

	@Override
	protected void onResume() {
		super.onResume();
	}

	@Override
	public void onBackPressed() {
		super.onBackPressed();
//		finish();
//		Intent mIntent = new Intent(HtmlActivity.this, MainActivity.class);
//		mIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
//				| Intent.FLAG_ACTIVITY_SINGLE_TOP);// 如果住界面
//													// 则不会new一个主界面,使用已有的界面.满足从ACTIvity从外部发起主界面.
//		startActivity(mIntent);
	}


}
